package com.hyh.feign.clients;

import com.hyh.feign.domain.Product;
import com.hyh.feign.result.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "productservice")
public interface ProductClient {
    @GetMapping("/api/product/{id}")
    Product getProductById(@PathVariable("id") Long id);

    // 更新库存
    @PutMapping("/api/product/updateStock/{id}")
    void updateStock(@PathVariable("id") Long id,
                     @RequestParam("stock") Integer stock);
}
